function websocket(){
	var socket = new WebSocket('ws://192.168.0.204:8081');
	socket.binaryType = 'arraybuffer';
	var listener = {};
	var middleWare = {
		getMedia: function(data, fn){
			fn(CORE.ResourceController.createFilesFromStream(data));
		},
	};	
	/**
	 * @type mediaItem
	 */
	var streamItem = null;
	
	this.init = function(){};	
		
	socket.onopen = function (w) {
		console.log('onopen', w);
	}; 
	socket.onmessage = function (e) {
		var data = e.data;
		if(data.byteLength){
			if(streamItem){
				streamItem.addChunk(data);
			}
		 	//if streamFile then decode and addchunk
		}else if(typeof data == 'string'){
			data = JSON.parse(data);//async geht auch mit callback
			if(middleWare.hasOwnProperty(data.msg)){
				middleWare[data.msg](data.body, listener[data.msg]);
			}else if(listener[data.msg]){
				listener[data.msg](data.body);
			}else{
				//error
			}
		}
	}; 
	socket.onclose = function (e) {
		console.log('close', e);
	}; 
	/**
	 * registers an message listener (each event holds ONE listener)
	 * @param name string message name
	 * @param fn callback(data)
	 */
	this.on = function(name, fn){
		listener[name] = fn;
	};
	/**
	 * emit send message and register an message listener.
	 * the answer has the same message name
	 * @param name string message name
	 * @param e object/array/string/int    message data
	 * @param fn callback
	 */
	this.emit = function(name, data, fn){
		this.on(name, fn);
		if(socket.readyState != socket.OPEN)return false;//eventuel fn mit nem err aufrufen?? damit weiß der emiter auch was sache is
		var msg = {
			msg: name,
			body: data	
		};
		socket.send(JSON.stringify(msg)); 
	};
	/**
	 * registriert ein mediaItem und startet den stream
	 * onReadyCallback
	 * @param mediaItem
	 * @param options object
	 */
	this.getMediaStream = function(item, options){
		if(socket.readyState != socket.OPEN)return false;//eventuel fn mit nem err aufrufen?? damit weiß der emiter auch was sache is
		streamItem = item;
		this.on('mediaStreamFinished', function(){
			//streamItem = null;
			item.complete();
		});
		var settings = {
			url: item.Url,
			off: 0
		};
		$.extend(settings, options);
		var msg = {
			msg: 'getMediaStream',
			body: settings
		};
		console.log(msg);
		socket.send(JSON.stringify(msg));
	};
	this.init();
};